import Vue from 'vue'
import App from './App.vue'
// 引入路由
import router from './router'

// 引入全局的css样式
import './assets/css/global.css'
import ElementUI from 'element-ui'
// 引入iconfont图标样式文件
import './assets/font/iconfont.css'
// 引入axios
import axios from 'axios'
// 在请求拦截器中配置token
axios.interceptors.request.use(function (config) {
  var token = window.sessionStorage.getItem('token')
  config.headers.Authorization = token
  return config
}, function (error) {
  // Do something with request error
  return Promise.reject(error)
})
// 配置公共根地址
axios.defaults.baseURL = 'http://127.0.0.1:11333/api/private/v1/'
// 将axios用原型继承的方式继承给Vue
Vue.prototype.$http = axios
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
